package lock.lock;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Classname PessimismOptimismLock
 * @Description 悲观锁、乐观锁对比
 * @Date 2024/1/21 16:36
 * @Author zhuzhenguo
 */
public class PessimismOptimismLock {

    int a;

    public static void main(String[] args) {
        AtomicInteger atomicInteger = new AtomicInteger();
        int i = atomicInteger.incrementAndGet();
        System.out.println(i);
    }

    public synchronized void testMethod() {
        a++;
    }

}
